package psi.vote.view.bean;

import model.Voter;
import psi.vote.view.interfaces.IVoteSystem;
import psi.vote.view.service.VoteSystemRest;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;

/**
 * Created with IDEA.
 * Voter: Ѱ
 * Date: 12.10.14
 * Time: 12:35
 */
@ManagedBean
@ViewScoped
public class ViewBean {
    private IVoteSystem system = new VoteSystemRest();
    private Voter voter;
    private String userId;
    private UserBean userBean;

    public ViewBean() {
        userBean = (UserBean) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("userBean");
        voter = system.getVoter(userBean.getEmail());
    }



    //Actions

    public void someAct(){


    }
    // GS
    public Voter getVoter() {
        return voter;
    }

    public void setVoter(Voter voter) {
        this.voter = voter;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }
}
